package com.pulse.base.service.impl;

import com.pulse.base.domain.CircuitMeasureRefer;
import com.pulse.base.mapper.CircuitMeasureReferMapper;
import com.pulse.base.service.ICircuitMeasureReferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 参考曲线
 */
@Service
public class CircuitMeasureReferServiceImpl implements ICircuitMeasureReferService {

    @Autowired
    private CircuitMeasureReferMapper circuitMeasureReferMapper;

    /**
     * 根据设备编号和端口号查询
     *
     * @param deviceNo
     * @param channel
     * @return
     */
    @Override
    public CircuitMeasureRefer selectCircuitMeasureReferByDeviceNoAndChannel(String deviceNo, Integer channel) {
        return circuitMeasureReferMapper.selectByDeviceNoAndChannel(deviceNo,channel);
    }

    /**
     * 新增
     *
     * @param circuitMeasureRefer
     * @return
     */
    @Override
    public int insertCircuitMeasureRefer(CircuitMeasureRefer circuitMeasureRefer) {
        return circuitMeasureReferMapper.insertCircuitMeasureRefer(circuitMeasureRefer);
    }

    /**
     * 修改
     *
     * @param circuitMeasureRefer
     * @return
     */
    @Override
    public int updateCircuitMeasureRefer(CircuitMeasureRefer circuitMeasureRefer) {
        return circuitMeasureReferMapper.updateCircuitMeasureRefer(circuitMeasureRefer);
    }

    /**
     * 根据measureId删除
     *
     * @param measureId
     * @return
     */
    @Override
    public int deleteByMeasureId(Long measureId) {
        return circuitMeasureReferMapper.deleteCircuitMeasureReferByMeasureId(measureId);
    }

    /**
     * 根据设备id删除
     *
     * @param deviceNo
     * @return
     */
    @Override
    public int deleteByDeviceNo(String deviceNo) {
        return circuitMeasureReferMapper.deleteCircuitMeasureReferByDeviceNo(deviceNo);
    }
}
